package com.vtquang.mymaps;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import android.graphics.drawable.Drawable;

//http://free.worldweatheronline.com/feed/weather.ashx?q=1.00,1.00&format=xml&num_of_days=5&key=61c9855e37163241131901
//http://free.worldweatheronline.com/feed/weather.ashx?q=10.881859,106.633301&format=xml&num_of_days=5&key=61c9855e37163241131901
public class WeatherInformation {

	private String date;

	public String getDate() {
		return date;
	}

	public void setDate(String date) {

		this.date = date;
	}
	
	private String weatherIconUrl;
	
    public String getWeatherIconUrl() {
		return weatherIconUrl;
	}

	public void setWeatherIconUrl(String weatherIconUrl) {
		this.weatherIconUrl = weatherIconUrl;
		 InputStream is;
		try {
			is = (InputStream) new URL(weatherIconUrl).getContent();
			_icon = Drawable.createFromStream(is, "src name");
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			_icon = null;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			_icon = null;
		} 
	}

	private int tempMaxC;
	
	public int getTempMaxC() {
		return tempMaxC;
	}

	public void setTempMaxC(int tempMaxC) {
		this.tempMaxC = tempMaxC;
	}

	private int tempMinC;
	
	public int getTempMinC() {
		return tempMinC;
	}

	public void setTempMinC(int tempMinC) {

		this.tempMinC = tempMinC;
	} 
	
	private Drawable _icon;
	
	public Drawable get_icon() {
		return _icon;
	}

	public void set_icon(Drawable _icon) {
		this._icon = _icon;
	}
	
	public WeatherInformation(){
		this.setDate(null);
		this.setTempMaxC(0);
		this.setTempMinC(0);
		this.setWeatherIconUrl(null);
	}
	public WeatherInformation(String _date,String _urlIcon,int tempMax, int tempMin){
		this.setDate(_date);
		this.setTempMaxC(tempMax);
		this.setTempMinC(tempMin);
		this.setWeatherIconUrl(_urlIcon);
	}

	
}
